package com.wx.spring.ioc.factory;

import com.wx.spring.House;
import com.wx.spring.constant.Constants;
import com.wx.spring.ioc.IocContainer;
import com.wx.spring.ioc.inject.InjectAutowiredBean;
import com.wx.spring.ioc.inject.InjectBean;
import com.wx.spring.ioc.inject.InjectXmlBean;
import com.wx.spring.test.service.service.impl.TestImpl;
import com.wx.spring.test.service.service.impl.TestImpl2;
import lombok.extern.slf4j.Slf4j;

/**
 * @author wx
 * @Description: 初始化
 * @date 2019/1/9 000920:26
 */
@Slf4j
public class InitBean {
    /**
     * @description: 初始化
     * @author: wx
     * @date: 2019/1/15 0015
     * @param 
     * @return: void
     */
    public void initBeans() {
        //初始化spring xml配置
        initXmlBeans(Constants.CONTEXT_CONFIG_LOCATION);
        //初始化spring mvc配置
        initXmlBeans(Constants.SPRINGMVC_CONFIG_LOCATION);
        //扫描设置注解的类
        initAutowiredBeans(Constants.CONTEXT_CONFIG_LOCATION);
    }

    /**
     * @param contextConfigLocation
     * @description: 初始化xml中bean内容的方法
     * @author: wx
     * @date: 2019/1/14 0014
     * @return: void
     */
    private void initXmlBeans(String contextConfigLocation) {
        InjectBean injectXmlBean = new InjectXmlBean();
        injectXmlBean.injectBeanMap(contextConfigLocation);
    }


    /**
     * @param contextConfigLocation
     * @description: 扫描设置注解的类
     * @author: wx
     * @date: 2019/1/14 0014
     * @return: void
     */
    private void initAutowiredBeans(String contextConfigLocation) {
        InjectBean injectAutowiredBean = new InjectAutowiredBean();
        injectAutowiredBean.injectBeanMap(contextConfigLocation);
    }


}
